'use strict';
const dayjs = require("dayjs");
module.exports = app => {
    const { INTEGER, DATE, STRING  } = app.Sequelize;
    return app.model.define(
        'RabbitAutoCollect',
        {
            id: {type: INTEGER, primaryKey: true, autoIncrement: true},
            date: {
                type: DATE,
                get() {
                    return dayjs(this.getDataValue('date')).format('YYYY-MM-DD HH:mm:ss');
                }
            },
            age: INTEGER,
            room: INTEGER,
            room_out: INTEGER,
            use: INTEGER,
            monitor_key: INTEGER,
            monitor_value: STRING,
            room_text: STRING,
            room_out_text: STRING,
            use_text: STRING,
            monitor_key_text: STRING,

        },
        {
            tableName: 'auto_collect',
            timestamps: false, // 启用时间戳(createdAt, updatedAt)
        }
    );
};
// 生成mysql表
// CREATE TABLE `brand` (
//   `id` int(11) NOT NULL AUTO_INCREMENT,
//   `name` varchar(255) DEFAULT NULL COMMENT '品牌名称',
//   `logo` varchar(255) DEFAULT NULL COMMENT '品牌logo',
//   `sort` int(11) DEFAULT '0' COMMENT '排序',
//   `status` int(11) DEFAULT '1' COMMENT '状态' COMMENT '0:禁用 1:启用',
//   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
//   `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
//   PRIMARY KEY (`id`)
// ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

